﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AMail.Common;
using AMail.Common.Interfaces.Data;
using Elentok.Common.Wpf;

namespace AMail.Modules.Messages.ViewModels
{
  public class MessageSourceViewModel : ViewModelBase
  {
    private IMailMessage message;

    public MessageSourceViewModel(IMailMessage message)
    {
      this.message = message;
    }

    public string Text
    {
      get
      {
        if (this.message.Encoding == null)
          return Encoding.UTF8.GetString(this.message.Source);
        else
          return this.message.Encoding.GetString(this.message.Source);
      }
    }
  }
}
